*********************************
***  Trump paper - Figure 5
*** Created: 31/10/2020
*** Last updated: 21/05/2021
clear all
set scheme plottig
 

	local user = 1		/* user 1 = sergi, user 2 = Anja */

	if `user' == 1 {			// input relevant file path as per your computer

		global		main "/Users/aneundorf/Dropbox/Project_Populism/BA project/Analysis/Trump_Replication files/"
		global 		graphs 			"${main}Graphs/"
		global 		results			"${main}Results/"
	}

cd "${main}"
use "Data/US_data_recoded.dta", clear

global controls_all female age01 educ2 educ3 dom2 dom3 dom4 ethnic2 ethnic3 ethnic4 relig3 relig2


*------------------------------------------------------------
*Figure 5


reg trump_vsbiden ib4.Group##ib2.partisan_cat $controls_all
margins, dydx(i.Group) at(partisan_cat=(1(1)3))

marginsplot, horiz xline(0) plot1opts(lc(none) mc(black)) ci1opt(lc(black)) plot2opts(lc(none) mc(none)) plot3opts(lc(none) mc(none)) ci2opt(lc(none)) ci3opt(lc(none)) legend(off) xline(0) xtitle("Marginal effect of economy treatment", size(large)) ylabel(, labsize(medlarge)) xlabel(-.5(.1).4, labsize(medium)) ytitle("Partisanship", size(large)) title("A. Treatment: Economy", size(vlarge)) name(pid_econ, replace) xsize(8) ysize(3)

marginsplot, horiz plot2opts(lc(none) mc(black)) ci2opt(lc(black)) plot1opts(lc(none) mc(none)) plot3opts(lc(none) mc(none)) ci1opt(lc(none)) ci3opt(lc(none)) legend(off) xline(0) xtitle("Marginal effect of gov. management treatment", size(large)) ylabel(, labsize(medlarge)) xlabel(-.5(.1).4, labsize(medium)) ytitle("Partisanship", size(large)) title("B. Treatment: Gov. management", size(vlarge)) name(pid_gov, replace) xsize(8) ysize(3)


marginsplot, horiz plot3opts(lc(none) mc(black)) ci3opt(lc(black)) plot2opts(lc(none) mc(none)) plot1opts(lc(none) mc(none)) ci2opt(lc(none)) ci1opt(lc(none)) legend(off) xline(0) xtitle("Marginal effect of China virus treatment", size(large)) ylabel(, labsize(medlarge)) xlabel(-.5(.1).4, labsize(medium)) ytitle("Partisanship", size(large)) title("C. Treatment: China virus", size(vlarge)) name(pid_immig, replace) xsize(8) ysize(3)


graph combine pid_econ  pid_gov pid_immig, row(3) graphregion(fcolor(white) lc(black)) xsize(6) ysize(9) 
graph save  "${graphs}Figure5.gph",  replace
graph export  "${graphs}Figure5.pdf", as(pdf) replace
